package work.timejay.user.service.books.impl;

import work.timejay.common.SuperServiceImpl;
import work.timejay.user.entity.books.UserBookType;
import work.timejay.user.mapper.books.UserBookTypeMapper;
import work.timejay.user.service.books.UserBookTypeService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 用户book类型表 服务实现类
 * </p>
 *
 * @author 王文杰
 * @since 2023-11-23
 */
@Service
public class UserBookTypeServiceImpl extends SuperServiceImpl<UserBookTypeMapper, UserBookType> implements UserBookTypeService {

    @Override
    public void saveUserBookInfoByUserId(List<Long> likeType, Long userId) {
        List<UserBookType> list = new ArrayList<>();
        likeType.forEach(e -> {
            UserBookType bean = UserBookType.createAddEntity(e, userId);
            list.add(bean);
        });
        saveBatch(list);
    }
}
